﻿//========================================================= 
/**@file ComMifare1Card.h 
 * @brief 串口M1卡设备驱动 
 * 
 * @date 2014-10-21   20:40:46 
 * @author Zhyioo 
 * @version 1.0
 */ 
//--------------------------------------------------------- 
#ifndef _LIBZHOUYB_COMMIFARE1CARD_H_
#define _LIBZHOUYB_COMMIFARE1CARD_H_
//--------------------------------------------------------- 
#include "../base/IMemoryCard.h"
using namespace zhou_yb::device::iccard::extension::base;

#include "../../device/ComStorageCardDevAdapter.h"
using zhou_yb::device::iccard::device::ComContactlessStorageCardDevAdapter;
//--------------------------------------------------------- 
namespace zhou_yb {
namespace device {
namespace iccard {
namespace extension {
namespace device {
//--------------------------------------------------------- 
/// COM设备4428卡驱动
class ComMifare1Card : 
    public IMifare1Card,
    public ComContactlessStorageCardDevAdapter
{
public:
    //----------------------------------------------------- 
    //@{
    /**@name 
     * @brief IMifare1Card成员函数 
     */ 
    /// 认证扇区
    virtual bool VerifySector(byte sectorIndex, const ByteArray& key_6, char pinType)
    {
        pinType = _get_upper(pinType) == 'B' ? 0x61 : 0x60;
        return ComContactlessStorageCardDevAdapter::AuthSector(sectorIndex, pinType, key_6);
    }
    /// 读块
    virtual bool ReadBlock(byte blockIndex, ByteBuilder& data_16)
    {
        return ComContactlessStorageCardDevAdapter::ReadBlock(blockIndex, data_16);
    }
    /// 写块
    virtual bool WriteBlock(byte blockIndex, const ByteArray& data_16)
    {
        return ComContactlessStorageCardDevAdapter::WriteBlock(blockIndex, data_16);
    }
    //@}
    //----------------------------------------------------- 
};
//--------------------------------------------------------- 
} // namespace device
} // namespace extension
} // namespace iccard
} // namespace device
} // namespace zhou_yb
//--------------------------------------------------------- 
#endif // _LIBZHOUYB_COMMIFARE1CARD_H_
//========================================================= 